<template>
  <t-dialog
    :header="header"
    :visible.sync="visible"
    :onClose="closeDialog"
    :closeOnOverlayClick="false"
    :confirmBtn="null"
    width="80%"
    top="5%"
  >
   <div style="height: 65vh">
     <t-divider style="font-size: 20px">评审组信息</t-divider>
     <t-form labelWidth="150px" :data="formData" ref="form"  :colon="true">
       <t-row style="row-gap: 10px">
         <t-col :span="6">
           <t-form-item label="分组名" name="name">
             {{formData.name}}
           </t-form-item>
         </t-col>

         <t-col :span="6">
           <t-form-item label="学科分类" name="subjectClassification">
             {{formData.subjectClassification.join(",") | filterByDict(dict.type.subject_classification) }}
           </t-form-item>
         </t-col>
         <t-col :span="6">
           <t-form-item label="评审业务类型" name="reviewType">
             {{ formData.reviewType | filterByDict(dict.type.review_type) }}
           </t-form-item>
         </t-col>
<!--         <t-col v-if="['1'].includes(formData.reviewType)" :span="6">-->
<!--           <t-form-item label="指标体系" name="indexId">-->
<!--             {{ formData.indexId | filterByDict(dataOptions) }}-->
<!--             <t-button v-if="formData.indexId" @click="dialog.header='评审指标体系详情';dialog.objId=formData.indexId;dialog.open_review_standard=true"-->
<!--                       variant="text" class="t-button-link">-->
<!--               <t-icon name="info-circle" slot="icon"/>-->
<!--               详情-->
<!--             </t-button>-->
<!--           </t-form-item>-->
<!--         </t-col>-->

         <t-col :span="6">
           <t-form-item label="专家评审开始时间" name="startReviewDate">
             {{formData.startReviewDate}}
           </t-form-item>
         </t-col>
         <t-col :span="6">
           <t-form-item label="专家评审截止时间" name="endReviewDate">
             {{formData.endReviewDate}}
           </t-form-item>
         </t-col>
         <t-col :span="6">
           <t-form-item label="评审会议时间" name="reviewMeetingDate">
             {{formData.reviewMeetingDate}}
           </t-form-item>
         </t-col>
         <t-col :span="6">
           <t-form-item label="分组说明" name="note">
             {{formData.note}}
           </t-form-item>
         </t-col>
       </t-row>
     </t-form>
     <t-divider style="font-size: 20px" v-if="['1'].includes(formData.reviewType)">评审指标体系</t-divider>
     <add-edit-review-standard v-if="['1'].includes(formData.reviewType)" :editOpen="false" :is-dialog="false" :objId="formData.indexId"></add-edit-review-standard>
   </div>
  </t-dialog>
</template>

<script>
import AddEditReviewStandard from "./add-edit-review-standard.vue";

export default {
  name: "reviewGroupDetail",
  dicts: ['review_type', 'subject_classification'],
  components:{
    AddEditReviewStandard
  },
  props: {
    header: String,
    objId: [String,Number],
  },
  data(){
    return {
      visible: true,
      formData:{
        id: '',
        reviewType: '',
        name: '',// 分组名
        note: '',
        subjectClassification: [],
        planName: "",
        reviewMeetingDate: ''
      }
    }
  },
  watch: {
    objId: {
      immediate: true,
      handler(val) {
        if (val) {
          this.getObj();
        }
      }
    }
  },
  methods:{
    getObj(){
      this.$api.kjxm.review.teamGet(this.objId).then((response) => {
        response.data.subjectClassification = response.data.subjectClassification?response.data.subjectClassification.split(",").filter(item=> item !== ''):[]
        Object.assign(this.formData, response.data);
      }).catch((e) => {
        this.$message.error(e.toString());
      });
    },
    closeDialog() {
      this.$emit("update:visible", false);
    },
  }
}
</script>

<style scoped>

</style>
